package com.chinaunicom.emergency.config;

import com.chinaunicom.emergency.interceptor.PermissionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author liliang
 * @date 2019-12-13
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 自己定义的拦截器类
     *
     * @return
    */
    @Autowired
    private PermissionInterceptor permissionInterceptor;

    /**
     * 添加拦截器
     *
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(permissionInterceptor).addPathPatterns("/**");
    }

}
